package step1_homework3;

import java.util.List;
import java.util.Scanner;

public class Student_remove {
    public static List stu_re(List list ){
        System.out.println("请输入要删除学生的id：");
        Scanner sc =new Scanner(System.in);
        int id = sc.nextInt();
        for (int i = 0; i <list.size() ; i++) {
            Student o = (Student) list.get(i);
            if (o.getId().equals(id)){
                list.remove(o);
                break;
            }else {
                System.out.println("集合中不存在此元素！！！！");
                break;
            }

        }
        return list;
    }
}
